% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/table-helpers.R
\name{collapse_table}
\alias{collapse_table}
\title{Reduce the dimensionality of the table}
\usage{
collapse_table(
  poptable,
  area_var,
  X_vars,
  count_var,
  report = "counts",
  new_name = "n_aggregate",
  warnings = FALSE
)
}
\arguments{
\item{poptable}{The population table, collapsed in terms of counts. Must contain
all variables in the RHS of \code{formula}, as well as the variables specified in
\code{area_var} and \code{count_var} below.}

\item{area_var}{A character vector of the area of interest.}

\item{X_vars}{A character vector of the variables to keep. By design, this
should be fewer variables than what is available in \code{poptable}.}

\item{count_var}{A character variable that specifies which variable in \code{poptable}
indicates the count}

\item{report}{Should the output be in simple counts (the default, \code{"counts"}) or
the proportion that count represents in the area (\code{"proportions"})?}

\item{new_name}{What should the new count (or proportion) variable be called?}

\item{warnings}{Show some warnings about zero cells in the original data?
Defaults to \code{FALSE}}
}
\value{
A dataframe of counts or proportions. By design, it will include the
variables \code{area_var}, \code{X_vars}, and whatever is specified in \code{new_name}.
}
\description{
Reduce the dimensionality of the table
}
\examples{

 # If you want to estimate education by female and age
 collapse_table(acs_race_NY, area_var = "cd", X_vars = c("female", "age"),
                count_var = "count")

 # Report proportions
 collapse_table(acs_race_NY, area_var = "cd", X_vars = c("female", "age"),
                count_var = "count",
                report = "proportions", new_name = "prop_in_cd")

}
